export const formTypeData = [
	'text', 'number', 'textarea', 'select', 'tree-select', 'tree', 'cascader', 'checkbox-group', 'checkbox', 
	'switch', 'radio', 'input-range','upload','date','date-range', 'date-range-split',
	'transfer', 'table', 'table-edit', 'select-content', 'slot'
]

const money = len => {
	if(len == 3 ) return 10
	else if(len == 4 ) return 100
	else if(len == 5 ) return 1000
	else if(len == 6 ) return '1'
	else if(len == 7 ) return '10'
	else if(len == 8 ) return '100'
	else if(len == 9 ) return '1000'
	else if(len == 10 ) return '_1'
	else if(len == 11 ) return '_10'
	else if(len == 12 ) return '_100'
	else if(len == 13 ) return '_1000'
	else return 0
}
const dateData = [
	{ label:'YYYY-MM-DD', value: 0 },
	{ label:'YYYY-MM-DD HH:mm:ss', value: 1 },
	{ label:'YYYY-MM-DD HH:mm', value: 2 }
]
export const formTypeSetData = {
	number: ({len, data_type}) => [
		{ label:'最小值', name:'min', type: 'number'},
		{ label:'范围', name:'range', mode:'number', type: 'input-range'},
		data_type === 'decimal_len' ? { label:'money 验证', name:'money', value: money(len)  } : null
	],
	text: ({ len }) => [
		{ label:'最大长度', name:'maxLen', type: 'number', value: len},
		{ label:'自定义验证', name:'rule'},
		{ label:'显示最大长度数字', name:'maxLength', type: 'number', value: len},
	],
	radio: () => [
		{ label:'模式', name:'mode', type: 'select', data:['button']},
		{ label:'api', name:'api'},
	],
	textarea: () => [
		{ label:'行高', name:'rows', type: 'number' },
		{ label:'最大长度', name:'maxLen', type: 'number'},
		{ label:'显示最大长度数字', name:'maxLength', type: 'number'},
	],
	select: () => [
		{ label:'api', name:'api'},
		{ label:'多选', name:'mul', type:'radio', mode:'button'},
		{ label:'是否分组', name:'group', type:'radio', mode:'button'},
		{ label:'是否缓存', name:'cache', type:'radio', mode:'button'},
		{ label:'是否提交文本', name:'subtxt', type:'radio', mode:'button'},
	],
	'tree-select': () => [
		{ label:'api', name:'api'},
	],
	tree: () => [
		{ label:'api', name:'api'},
	],
	cascader: () => [
		{ label:'api', name:'api'},
	],
	transfer: () => [
		{ label:'api', name:'api'},
	],
	'checkbox-group':  () => [
		{ label:'api', name:'api'},
	],
	date: () => [
		{ label:'日期格式', name:'format', type:'select', data:dateData },
		{ label:'禁用之后', name:'after', type:'radio', mode:'button'},
		{ label:'禁用之前', name:'before', type:'radio', mode:'button'}
	],
	'date-range': () => [
		{ label:'日期格式', name:'format', type:'select', data:dateData }
	],
	upload: () => [
		{ label:'mongo', name:'mongo', type:'radio', mode:'button'},
		{ label:'多文件上传', name:'mul', type:'radio', mode:'button'},
		{ label:'按钮文本', name:'btnText' },
		{ label:'列表类型', name:'listType', type:'select', data:['button']},
	]
}